const mongoose = require("mongoose")

const Schema = mongoose.Schema

var InfoClassSchema = new Schema({
    name: {
        type: String,
        required: true
    },
    InfoList: [
        {
            type: Schema.Types.ObjectId,
            ref: "info"
        }
    ],
    status: {
        type: String,
        default: "1"
    }
}, {
    timestamps: {
        createdAt: "addtime",
        updatedAt: "updatetime"
    }
})

var InfoSchema = new Schema({
    title: {
        type: String,
        required: true
    },
    itemClass: {
        type: Schema.Types.ObjectId,
        ref: "infoClass"
    },
    sendBy: {
        type: Schema.Types.ObjectId,
        ref: "users"
    },
    fm: {
        type: String,
    },
    content: {
        type: String,

    },
    audio: {
        type: String,
    },
    video: {
        type: String,
    },
    status: {
        type: String,
        default: "1"
    }
}, {
    timestamps: {
        createdAt: "addtime",
        updatedAt: "updatetime"
    }
})

module.exports = {
    InfoClass: mongoose.model("infoClass", InfoClassSchema),
    Info: mongoose.model("info", InfoSchema),
}